#!/bin/bash
##1,区域字典表
sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect jdbc:mysql://192.168.11.244:4000/xls_source_jry \
--username root \
--password 123456 \
--table t_district_jry \
--hcatalog-database xls_ods_jry \
--hcatalog-table ods_district_jry \
--fields-terminated-by '\t' \
--split-by id \
--fetch-size 1000 \
--m 2
# 2.ods_date 时间维度表
# 2.ods_date 时间维度表
sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect jdbc:mysql://192.168.11.244:4000/xls_source_jry \
--username root \
--password 123456 \
--table t_date_jry \
--hcatalog-database xls_ods_jry \
--hcatalog-table ods_date_jry \
--fields-terminated-by '\t' \
--split-by dim_date_id \
--fetch-size 1000 \
--m 2
##3,用户登录记录表
sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect jdbc:mysql://192.168.11.244:4000/xls_source_jry \
--username root \
--password 123456 \
--query "select *,date_format(login_time,'%Y-%m-%d') as dt from xls_source_jry.t_user_login_jry where 1=1 and \$CONDITIONS" \
--hcatalog-database xls_ods_jry \
--hcatalog-table ods_user_login_jry \
--fields-terminated-by '\t' \
--split-by id \
--fetch-size 1000 \
--m 2
##4,商品评价表
sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect jdbc:mysql://192.168.11.244:4000/xls_source_jry \
--username root \
--password 123456 \
--query "SELECT *, DATE_FORMAT(create_time, '%Y-%m-%d') AS dt FROM xls_source_jry.t_goods_evaluation_jry WHERE 1 = 1 AND \$CONDITIONS" \
--hcatalog-database xls_ods_jry \
--hcatalog-table ods_goods_evaluation_jry \
--fields-terminated-by '\t' \
--split-by id \
--fetch-size 1000 \
--m 2
# 5.ods_order_pay 订单组支付表
sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect jdbc:mysql://192.168.11.244:4000/xls_source_jry \
--username root \
--password 123456 \
--query "SELECT *, DATE_FORMAT(create_time, '%Y-%m-%d') AS dt FROM xls_source_jry.t_order_pay_jry WHERE 1 = 1 AND \$CONDITIONS" \
--hcatalog-database xls_ods_jry \
--hcatalog-table ods_order_pay_jry \
--fields-terminated-by '\t' \
--split-by id \
--fetch-size 1000 \
--m 2
# 6.ods_store_lvzx 店铺表
sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect jdbc:mysql://192.168.11.244:4000/xls_source_jry \
--username root \
--password 123456 \
--query "SELECT *, DATE_FORMAT(coalesce(update_time,create_time), '%Y-%m-%d') AS dt FROM xls_source_jry.t_store_jry WHERE 1 = 1 AND \$CONDITIONS" \
--hcatalog-database xls_ods_jry \
--hcatalog-table ods_store_jry \
--fields-terminated-by '\t' \
--split-by id \
--fetch-size 1000 \
--m 2
# 7.ods_trade_area 商圈表  --没导入成功
sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect jdbc:mysql://192.168.11.244:4000/xls_source_jry \
--username root \
--password 123456 \
--query "SELECT *, DATE_FORMAT(coalesce(update_time,create_time), '%Y-%m-%d') AS dt FROM xls_source_jry.t_trade_area_jry WHERE 1 = 1 AND \$CONDITIONS" \
--hcatalog-database xls_ods_jry \
--hcatalog-table ods_trade_area_jry \
--fields-terminated-by '\t' \
--split-by id \
--fetch-size 1000 \
--m 2
# 8.ods_location 地址信息表
sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect jdbc:mysql://192.168.11.244:4000/xls_source_jry \
--username root \
--password 123456 \
--query "SELECT *, DATE_FORMAT(coalesce(update_time,create_time), '%Y-%m-%d') AS dt FROM xls_source_jry.t_location_jry WHERE 1 = 1 AND \$CONDITIONS" \
--hcatalog-database xls_ods_jry \
--hcatalog-table ods_location_jry \
--fields-terminated-by '\t' \
--split-by id \
--fetch-size 1000 \
--m 2
# 9.ods_goods 店铺商品表
sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect jdbc:mysql://192.168.11.244:4000/xls_source_jry \
--username root \
--password 123456 \
--query "SELECT *, DATE_FORMAT(coalesce(update_time,create_time), '%Y-%m-%d') AS dt FROM xls_source_jry.t_goods_jry WHERE 1 = 1 AND \$CONDITIONS" \
--hcatalog-database xls_ods_jry \
--hcatalog-table ods_goods_jry \
--fields-terminated-by '\t' \
--split-by id \
--fetch-size 1000 \
--m 2
# 10.ods_goods_class 商品分类表
sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect jdbc:mysql://192.168.11.244:4000/xls_source_jry \
--username root \
--password 123456 \
--query "SELECT *, DATE_FORMAT(coalesce(update_time,create_time), '%Y-%m-%d') AS dt FROM xls_source_jry.t_goods_class_jry WHERE 1 = 1 AND \$CONDITIONS" \
--hcatalog-database xls_ods_jry \
--hcatalog-table ods_goods_class_jry \
--fields-terminated-by '\t' \
--split-by id \
--fetch-size 1000 \
--m 2
# 11.ods_brand 品牌表
sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect jdbc:mysql://192.168.11.244:4000/xls_source_jry \
--username root \
--password 123456 \
--query "SELECT *, DATE_FORMAT(coalesce(update_time,create_time), '%Y-%m-%d') AS dt FROM xls_source_jry.t_brand_jry WHERE 1 = 1 AND \$CONDITIONS" \
--hcatalog-database xls_ods_jry \
--hcatalog-table ods_brand_jry \
--fields-terminated-by '\t' \
--split-by id \
--fetch-size 1000 \
--m 2
# 12.ods_shop_order 订单表
sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect jdbc:mysql://192.168.11.244:4000/xls_source_jry \
--username root \
--password 123456 \
--query "SELECT *, DATE_FORMAT(coalesce(update_time,create_time), '%Y-%m-%d') AS dt FROM xls_source_jry.t_shop_order_jry WHERE 1 = 1 AND \$CONDITIONS" \
--hcatalog-database xls_ods_jry \
--hcatalog-table ods_shop_order_jry \
--fields-terminated-by '\t' \
--split-by id \
--fetch-size 1000 \
--m 2
# 13.ods_shop_order_address_detail 订单详情表
sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect jdbc:mysql://192.168.11.244:4000/xls_source_jry \
--username root \
--password 123456 \
--query "SELECT *, DATE_FORMAT(coalesce(update_time,create_time), '%Y-%m-%d') AS dt FROM xls_source_jry.t_shop_order_address_detail_jry WHERE 1 = 1 AND \$CONDITIONS" \
--hcatalog-database xls_ods_jry \
--hcatalog-table ods_shop_order_address_detail_jry \
--fields-terminated-by '\t' \
--split-by id \
--fetch-size 1000 \
--m 2
# 14.ods_goods_evaluation_detail 商品评价明细表
sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect jdbc:mysql://192.168.11.244:4000/xls_source_jry \
--username root \
--password 123456 \
--query "SELECT *, DATE_FORMAT(coalesce(update_time,create_time), '%Y-%m-%d') AS dt FROM xls_source_jry.t_goods_evaluation_detail_jry WHERE 1 = 1 AND \$CONDITIONS" \
--hcatalog-database xls_ods_jry \
--hcatalog-table ods_goods_evaluation_detail_jry \
--fields-terminated-by '\t' \
--split-by id \
--fetch-size 1000 \
--m 2
# 15.ods_trade_record 交易记录表
sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect jdbc:mysql://192.168.11.244:4000/xls_source_jry \
--username root \
--password 123456 \
--query "SELECT *, DATE_FORMAT(coalesce(update_time,create_time), '%Y-%m-%d') AS dt FROM xls_source_jry.t_trade_record_jry WHERE 1 = 1 AND \$CONDITIONS" \
--hcatalog-database xls_ods_jry \
--hcatalog-table ods_trade_record_jry \
--fields-terminated-by '\t' \
--split-by id \
--fetch-size 1000 \
--m 2
# 16.ods_order_settle 订单结算表
sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect jdbc:mysql://192.168.11.244:4000/xls_source_jry \
--username root \
--password 123456 \
--query "SELECT *, DATE_FORMAT(coalesce(update_time,create_time), '%Y-%m-%d') AS dt FROM xls_source_jry.t_order_settle_jry WHERE 1 = 1 AND \$CONDITIONS" \
--hcatalog-database xls_ods_jry \
--hcatalog-table ods_order_settle_jry \
--fields-terminated-by '\t' \
--split-by id \
--fetch-size 1000 \
--m 2
# 17.ods_refund_order 退款订单表
sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect jdbc:mysql://192.168.11.244:4000/xls_source_jry \
--username root \
--password 123456 \
--query "SELECT *, DATE_FORMAT(coalesce(update_time,create_time), '%Y-%m-%d') AS dt FROM xls_source_jry.t_refund_order_jry WHERE 1 = 1 AND \$CONDITIONS" \
--hcatalog-database xls_ods_jry \
--hcatalog-table ods_refund_order_jry \
--fields-terminated-by '\t' \
--split-by id \
--fetch-size 1000 \
--m 2
# 18.ods_shop_order_group 订单分组表
sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect jdbc:mysql://192.168.11.244:4000/xls_source_jry \
--username root \
--password 123456 \
--query "SELECT *, DATE_FORMAT(coalesce(update_time,create_time), '%Y-%m-%d') AS dt FROM xls_source_jry.t_shop_order_group_jry WHERE 1 = 1 AND \$CONDITIONS" \
--hcatalog-database xls_ods_jry \
--hcatalog-table ods_shop_order_group_jry \
--fields-terminated-by '\t' \
--split-by id \
--fetch-size 1000 \
--m 2
# 19.ods_shop_order_goods_details 订单和商品的中间表
sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect jdbc:mysql://192.168.11.244:4000/xls_source_jry \
--username root \
--password 123456 \
--query "SELECT *, DATE_FORMAT(coalesce(update_time,create_time), '%Y-%m-%d') AS dt FROM xls_source_jry.t_shop_order_goods_details_jry WHERE 1 = 1 AND \$CONDITIONS" \
--hcatalog-database xls_ods_jry \
--hcatalog-table ods_shop_order_goods_details_jry \
--fields-terminated-by '\t' \
--split-by id \
--fetch-size 1000 \
--m 2
# 20.ods_shop_cart 购物车
sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect jdbc:mysql://192.168.11.244:4000/xls_source_jry \
--username root \
--password 123456 \
--query "SELECT *, DATE_FORMAT(coalesce(update_time,create_time), '%Y-%m-%d') AS dt FROM xls_source_jry.t_shop_cart_jry WHERE 1 = 1 AND \$CONDITIONS" \
--hcatalog-database xls_ods_jry \
--hcatalog-table ods_shop_cart_jry \
--fields-terminated-by '\t' \
--split-by id \
--fetch-size 1000 \
--m 2
# 21.ods_store_collect 店铺收藏
sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect jdbc:mysql://192.168.11.244:4000/xls_source_jry \
--username root \
--password 123456 \
--query "SELECT *, DATE_FORMAT(coalesce(update_time,create_time), '%Y-%m-%d') AS dt FROM xls_source_jry.t_store_collect_jry WHERE 1 = 1 AND \$CONDITIONS" \
--hcatalog-database xls_ods_jry \
--hcatalog-table ods_store_collect_jry \
--fields-terminated-by '\t' \
--split-by id \
--fetch-size 1000 \
--m 2
# 22.ods_goods_collect 商品收藏
sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect jdbc:mysql://192.168.11.244:4000/xls_source_jry \
--username root \
--password 123456 \
--query "SELECT *, DATE_FORMAT(coalesce(update_time,create_time), '%Y-%m-%d') AS dt FROM xls_source_jry.t_goods_collect_jry WHERE 1 = 1 AND \$CONDITIONS" \
--hcatalog-database xls_ods_jry \
--hcatalog-table ods_goods_collect_jry \
--fields-terminated-by '\t' \
--split-by id \
--fetch-size 1000 \
--m 2
# 23.ods_order_delievery_item 订单配送详细信息表
sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect jdbc:mysql://192.168.11.244:4000/xls_source_jry \
--username root \
--password 123456 \
--query "SELECT *, DATE_FORMAT(coalesce(update_time,create_time), '%Y-%m-%d') AS dt FROM xls_source_jry.t_order_delievery_item_jry WHERE 1 = 1 AND \$CONDITIONS" \
--hcatalog-database xls_ods_jry \
--hcatalog-table ods_order_delievery_item_jry \
--fields-terminated-by '\t' \
--split-by id \
--fetch-size 1000 \
--m 2
